import request from '@/config/axios'

// 产品拨交单 VO
export interface DeliveryReceiptVO {
  id: number // 主键ID
  deliveryCode: string // 交拨单编号
  orderId: string // 订单ID
  orderTotal: number // 订单总数
  deliveryCount: number // 拨交数量
  outDeptId: number // 转出部门ID
  outDeptName: string // 转出部门名称
  recvDeptId: number // 接收部门ID
  recvDeptName: string // 接收部门名称
  submitTime: Date // 提交时间
  remark: string // 备注
}


// 产品拨交单 VO
export interface DeliveryReceiptConditionVO {
  orderId: string
  internalCode: string
  productionCode: string
  type: string
  deptId: number
  remark: string
  excludeCompletedProcessIdList: [number]
}

// 产品拨交单 API
export const DeliveryReceiptApi = {
  // 查询产品拨交单分页
  getDeliveryReceiptPage: async (params: any) => {
    return await request.get({ url: `/project/delivery-receipt/page`, params })
  },

  // 查询产品拨交单详情
  getDeliveryReceipt: async (id: number) => {
    return await request.get({ url: `/project/delivery-receipt/get?id=` + id })
  },

  // 新增产品拨交单
  createDeliveryReceipt: async (data: DeliveryReceiptVO) => {
    return await request.post({ url: `/project/delivery-receipt/create`, data })
  },

  // 修改产品拨交单
  updateDeliveryReceipt: async (data: DeliveryReceiptVO) => {
    return await request.put({ url: `/project/delivery-receipt/update`, data })
  },

  // 删除产品拨交单
  deleteDeliveryReceipt: async (id: number) => {
    return await request.delete({ url: `/project/delivery-receipt/delete?id=` + id })
  },

  // 导出产品拨交单 Excel
  exportDeliveryReceipt: async (params) => {
    return await request.download({ url: `/project/delivery-receipt/export-excel`, params })
  },

  //生成拨交单
  generateDeliveryReceipt: async (data: DeliveryReceiptConditionVO) => {
    return await request.post({ url: `/project/delivery-receipt/generateDeliveryReceipt`, data })
  },

  // 查询产品拨交单报表
  getDeliveryReceiptReport: async (params: any) => {
    return await request.get({ url: `/project/delivery-receipt/getDeliveryReceiptReport`, params })
  },

  exportDeliveryReceiptReport: async (params) => {
    return await request.download({ url: `/project/delivery-receipt/exportDeliveryReceiptReport`, params })
  },




}
